home *** CD-ROM | disk | FTP | other *** search
- Cliper callable function:
- ******************************************************************************
- cString := FP_STRING(nValue[,nPrec[,nRadix]])
-
- Function to convert a numeric value to a string. Intended mainly for
- diagnostic use, this function can generate sufficient digits to display
- all precision available.
-
- nValue Value to be converted.
-
- nPrec Number of significant digits to be generated. Precision is
- constrained to the inclusive range (4,52). The following
- table indicates the limits of meaningful precision for
- standard radices:
-
- Radix Precision
- 2 52
- 8 18
- 10 16
- 16 13
-
- nRadix Radix for conversion of normalized fraction digits. The
- radix is constrained to the inclusive range (2,16).
-
- Three display formats are produced:
-
- . Standard decimal fixed-point representation:
-
- "[-]D,DDD,DDD,DDd.dddd dddd ∙∙∙ ."
-
- D,DDD ∙∙∙ will contain spaces for leading zeros. A sign, if
- present, will be positioned adjacent to the first digit.
-
- . Normalized to (1 <= value < 2) with a binary scale factor.
- Fractional digits may be displayed in any radix from 2 to 16.
-
- "±1.dddd dddd ∙∙∙ B±eeee" -1023 <= eeee <= 1024
-
- The ddd represent fractional digits in the specified radix and
- ±eeee is a (decimally specified) binary scale factor. The actual
- value represented is (±1.dddd ∙∙∙ dddd) * (2^±eeee) where "*"
- and "^" indicate multiplication and exponentiation, respectively.
-
- . Standard Scientific Form
-
- "[-]D.dddd dddd ... e[-]nnn"
-
- D is a digit in the range (0,9); dddd ... are fractional places;
- e[-]nnn represents a power of 10. The actual value represented
- is D.dddd ... dddd * 10^([-]nnn)
-
- Notes: . For display in scientific form, transformation of values for
- use with a decimal scale factor results in loss of accuracy.
-
- . If precision and radix are not specified, the defaults are
- 16 and 10, respectively.
-
- . Output form is dependent on explicit radix specification,
- absolute magnitude of the value to be converted and a local
- static variable (useSci). See FP_SCI().
-
- if (radix is specified explicitly)
- {
- Output form is normalized with binary scale factor.
- }
- else if (useSci >= 2)
- {
- Output form is scientific.
- }
- else if (.0001 <= v < 1,000,000,000)
- {
- if (useSci == 0)
- Output form is fixed-point decimal.
- else
- Output form is scientific.
- endif
- }
- else
- {
- Output form is normalized with binary scale factor.
- }
- endif
-
- . In fixed decimal format, leading zeros to the left of the
- decimal point to not count toward satisfying the requested
- precision. In normalized, scaled format, the leading "1" does
- not count toward satisfying the requested precision.
-
- ******************************************************************************
- FP_SCI([nSci])
-
- Function to set useSci to control output form produced by FP_STRING().
-
- nSci . If not specified or not a number, useSci is replaced by its
- logical complement.
-
- . Valid states are 0, 1 and 2 no checking is done.
-
- ******************************************************************************
-